package org.dandelion.memo.activity;

import android.app.Activity;

import java.util.HashSet;
import java.util.Set;

public class ActivityCollector {
    private static final Set<Activity> activities = new HashSet<>();

    public static void add(Activity activity) {
        activities.add(activity);
    }

    public static void remove(Activity activity) {
        activities.remove(activity);
    }

    public static void finishAll() {
        for (Activity activity : activities) {
            if (!activity.isFinishing()) {
                activity.finish();
            }
        }
    }
}
